<template>
  <div class="bg">
    <button @click="getStudents">获取学生信息</button>
    <button @click="getCars">获取汽车的信息</button>
    <button @click="getLocal">请求本机上的学生文件（不走代理）</button>
  </div>
</template>

<script>
import axios from 'axios'
export default {
  name: "App",
  methods:{
    getStudents(){
      axios.get('http://localhost:8080/view/students').then(
          response=>{
            console.log("请求成功了,",response.data)
          },
          error=>{
            console.log("请求失败了，",error.messages)
          }
      )
    },
    getCars(){
      axios.get('http://localhost:8080/demo/cars').then(
          response=>{
            console.log("请求成功了，",response.data)
          },
          error=>{
            console.log("请求失败了，",error.message)
          }
      )
    },
    getLocal(){
      axios.get('http://localhost:8080/students').then(
          response=>{
            console.log("请求成功了，",response.data)
          },
          error=>{
            console.log("请求失败了，",error.message)
          }
      )
    }
  }
}
</script>

<style lang="less">

</style>
